home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2007 September
/
PCWSEP07.iso
/
Software
/
Resources
/
Internet
/
Maxthon 1.5.7 build 82
/
mcombo.exe
/
Plugin
/
Digg Sidebar
/
scripts
/
MaxthonLibrary.js
< prev
next >
Wrap
Text File
|
2006-08-31
|
2KB
|
82 lines
/**************************
Digg Sidebar
By Neo101
Version 1.0.0
**************************/
var SECURITY_ID = max_security_id
var PLUGIN_NAME = "Digg Sidebar"
var alreadyShowingError = false
window.onerror = showErrorMessage
var SETTINGS_FILE = 'Settings.ini'
var DEFAULT_SETTINGS_FILE = 'DefaultSettings.ini'
var timer
var defaultCheck = 'categoryFeed'
function showErrorMessage(message, url, line){
var d = new Date()
var date = d.getHours()+':'+d.getMinutes()+':'+d.getSeconds()
if(!alreadyShowingError)
external.get_tab(SECURITY_ID, external.cur_sel).window.status
= 'Message: '+message+' Line: '+line+' URL: '+url+' Date: '+date
alreadyShowingError = true
}
function readFile(filename) {
return external.readFile(SECURITY_ID,PLUGIN_NAME,filename)
}
function writeFile(filename,data) {
external.writeFile(SECURITY_ID,PLUGIN_NAME,filename,data)
}
function readSetting(Key, errorResponse) {
if(errorResponse == null)
errorResponse = ''
var returnValue = readIni(SETTINGS_FILE,"Settings", Key, 'error')
if(returnValue == 'error') {
var defaultFileValue = readIni(DEFAULT_SETTINGS_FILE,"Settings", Key, 'error')
if(defaultFileValue == 'error')
return errorResponse
else {
writeSetting(Key, defaultFileValue)
returnValue = defaultFileValue
}
}
return returnValue
}
function checkSettingsFile(){
if(readIni("settings.ini","Settings", defaultCheck, 'error') != 'error') return false
var defaultSettingsFile = readFile('DefaultSettings.ini')
if(defaultSettingsFile && defaultSettingsFile != '')
writeFile('Settings.ini', defaultSettingsFile)
return true
}
function readIni(file, section, key, errorResponse){
if(errorResponse == null)
errorResponse = ''
return external.m2_readIni(SECURITY_ID, PLUGIN_NAME, file, section, key, errorResponse)
}
function writeIni(file, section, key, data) {
external.m2_writeIni(SECURITY_ID, PLUGIN_NAME, file, section, key, data+'')
}
function writeSetting(key, data) {
writeIni(SETTINGS_FILE,"Settings", key, data+'')
}